const moduleFiles = require.context('./modules/', /** useSubdirectories 是否查找子目录 * */ true, /\.js$/)
export default moduleFiles.keys().reduce((modules, filename) => {
  const moduleName = filename.replace(/^\.\/(.*)\.\w+$/, '$1')
  // eslint-disable-next-line no-param-reassign
  modules[moduleName] = moduleFiles(filename).default
  return modules
}, {})
